﻿@model MobileSales.Model.Tasks.CyclicTask

@{
    View.Title = Strings.CyclicTasks + " - " + Strings.Edit;
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<script src="@Url.Content("~/Scripts/Tasks.js")" type="text/javascript"></script>
<h2>@Strings.CyclicTasks &nbsp;&raquo;&nbsp; @Strings.Edit</h2>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>@Strings.Fields</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.TaskInterval)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.TaskInterval)
            @Html.ValidationMessageFor(model => model.TaskInterval)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.EmployeeId)
        </div>
        <div class="editor-field">
            @Html.EmployeeSelect("EmployeeId", Model.EmployeeId, false)
        </div>

        @Html.HiddenFor(model => model.Id)

        <div class="editor-label">
            @Html.LabelFor(model => model.ClientId)
        </div>
        <div class="editor-field">    
            @Html.ClientSelect("ClientId", false, (Model.ClientId.HasValue) ? new int[] { Model.ClientId.Value } : null, true)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Info)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Info)
            @Html.ValidationMessageFor(model => model.Info)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Priority)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Priority)
            @Html.ValidationMessageFor(model => model.Priority)
        </div>

        <div class="editor-label">
            @ModelStrings.Date
        </div>
        <div class="editor-field">
            <input type="text" class="datepicker" id="datePickerDay" value="@Model.StartTime.ToShortDateString()" />
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.StartTime)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.StartTime)
            <input type="text" class="timepicker" id="timePickerStart" value="@Model.StartTime.ToShortTimeString()" />
            @Html.ValidationMessageFor(model => model.StartTime)

        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.EndTime)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.EndTime)
            <input type="text" class="timepicker" id="timePickerEnd" value="@Model.EndTime.ToShortTimeString()" />
            @Html.ValidationMessageFor(model => model.EndTime)
        </div>

         <div class="editor-label">
            @Html.LabelFor(model => model.TaskStatus)
        </div>
        <div class="editor-field">
            @Html.TaskStatusSelect("taskStatusId", Model.TaskStatus.Id)
        </div>   
        
         <div class="editor-label">
            @Html.LabelFor(model => model.TaskType)
        </div>
        <div class="editor-field">
            @Html.TaskTypeSelect("taskTypeId", Model.TaskType.Id)
        </div>     

        <p>
            <input type="submit" value="@Strings.Save" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink(Strings.BackToList, "Index", new { employeeId = Model.EmployeeId }, new { @class = "icon-button prev-icon" })
</div>

